<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Date
 *
 * @author chaporgin_a
 */
class VA_Form_ViewHelper_XHTML_Date extends VA_Form_ViewHelper {

    public function wrap(){
      $this->getElement()->setHTMLTagAttribute('type', 'text', TRUE);
      $this->getElement()->setHTMLTagAttribute('value', $this->getValueOfElement(), TRUE);
      $return = sprintf('<input %s />', $this->getElement()->getAllAttributesAsHTML());
      //TODO: get rid of this function somehow
      $this->generateJavascript();
      return $return;
    }
    /**
     * Warning!
     * 
     * THIS function breaks normal flow - it sends string directly to output
     * BEFORE any component is rendered. So be careful
     * 
     * @return mixed
     */
    protected function generateJavascript(){
      return include(JPATH_COMPONENT_ADMINISTRATOR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'FormElementDate.js.php');
    }
}

